//
//  HomePageSearchPersonTableViewCell.m
//  Taste
//
//  Created by 徐昊 on 16/9/24.
//  Copyright © 2016年 徐昊. All rights reserved.
//

#import "HomePageSearchPersonTableViewCell.h"
#import "HomePageSearchResultContent.h"
#import "UIImageView+WebCache.h"
#import "NSString+Vali.h"
@interface HomePageSearchPersonTableViewCell ()

@property (weak, nonatomic) IBOutlet UIImageView *pic;
@property (weak, nonatomic) IBOutlet UILabel *nickName;
@property (weak, nonatomic) IBOutlet UILabel *shortContent;
@property (weak, nonatomic) IBOutlet UIImageView *approveImage;

@end

@implementation HomePageSearchPersonTableViewCell

- (void)setContent:(HomePageSearchResultContent *)content {
    [self layoutIfNeeded];
    _content = content;
    _nickName.text = _content.nickname;
    _shortContent.text = _content.introduction;
    _pic.contentMode = UIViewContentModeScaleAspectFill;
    _pic.clipsToBounds = YES;
    _pic.layer.masksToBounds = YES;
    _pic.layer.cornerRadius = _pic.frame.size.width / 2;
    [_pic sd_setImageWithURL:[NSURL URLWithString:[NSString imageWebWithStr:_content.headimg]] placeholderImage:[UIImage imageNamed:@"IMG_Universal_Placeholder"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
    }];
    if ([_content.approve isEqualToString:@"1"]) {
        _approveImage.alpha = 1;
    } else {
        _approveImage.alpha = 0;
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
